﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NJL.WebUsers.Shop
{
    public partial class Services : BasePageVisitor
    {
        NJL.BLL.NJL_CS_SERVICE_TYPE bllServiceType = new BLL.NJL_CS_SERVICE_TYPE();
        NJL.BLL.NJL_COMPANY_SERVICE bllService = new BLL.NJL_COMPANY_SERVICE();
        NJL.BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        NJL.Model.NJL_COMPANY modelCompany;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet ds = bllServiceType.GetList("");
                rptService.DataSource = ds;
                rptService.DataBind();


                DataSet dsService = bllService.GetList("");
                string[] param = { "id" };
                pagenum.InnerHtml = Royalsoft.Common.Pager.GetPageNum(dsService, rptServiceList, 20, param);

                modelCompany = bllCompany.GetModel(Request.QueryString["id"].ToString());
                litName.Text = modelCompany.COMPANY_NAME;

                dsService = bllService.GetCompanyIdByTypeName(modelCompany.ID);
                rptService.DataSource = dsService;
                rptService.DataBind();
          
            }
        }
        protected void rptServiceList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Image img = e.Item.FindControl("imgPic") as Image;
                DataRowView row = (DataRowView)e.Item.DataItem;
                string id = row["IMAGE_CODE"].ToString();
                if (!string.IsNullOrEmpty(id))
                {
                    img.ImageUrl = BasePage.GetImageUrl(id);
                }
                else
                {
                  
                }
            }
        }
    }
}